from django.shortcuts import render
from django.http import HttpResponse
from .models import *

# Create your views here.

def toLogin_view(request):
    return  render(request,'login.html')



def login_view(request):
    u=request.POST.get("user",'')
    p=request.POST.get("pwd",'')

    if u and p:

        c = MyModel.objects.filter(stu_name=u,stu_psw=p).count()
        if c >= 1:
            return HttpResponse("登录成功！")
        else:
            return HttpResponse("登录失败密码错误！")

    else:
        return HttpResponse("请输入账密！")